Skip to content

test(decode): fix Errorf argument order in array-to-struct case#798

Closed
Solaris-star wants to merge 1 commit into
fxamacker:masterfrom
Solaris-star:fix/784-decode-errorf-arg-order
Closed

test(decode): fix Errorf argument order in array-to-struct case#798
Solaris-star wants to merge 1 commit into
fxamacker:masterfrom
Solaris-star:fix/784-decode-errorf-arg-order

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

In TestUnmarshalArrayToStructNoToArrayOptionError, the t.Errorf call for the "want error containing" branch swapped err.Error() and v1.

That makes failure messages misleading (and mismatches the format verbs).

Fix

Pass v1 then err.Error() to match:
Decode(%+v) returned error %q, want error containing %q

Fixes #784

Test plan

  • go test -run TestUnmarshalArrayToStruct .

TestUnmarshalArrayToStructNoToArrayOptionError swapped the decoded
value and error string in t.Errorf, producing misleading failure
output.

Fixes fxamacker#784
@fxamacker

Copy link
Copy Markdown
Owner

Per CONTRIBUTING.md, the issue-first step is meant to align on approach before the implementation work. But the referenced issue was opened by someone else and it was not approved by a maintainer to proceed to a PR.

Also, this PR is missing the PR template/checklist that is automatically added to all opened PRs.

The PR template asks each contributor to sign off on the Developer Certificate of Origin (DCO) certifying that you created the contribution and have the right to submit it under this project's license. Since AI-generated code has unclear provenance (and can reproduce licensed code), that certification is hard to stand behind for AI-written code.

Closing this PR, since it duplicates a fix already offered by the issue author, the issue wasn't approved to proceed to a PR by a maintainer, the PR template/DCO is missing, and the commit is missing the required "Signed-off-by:" line.

Thanks for understanding.

@fxamacker fxamacker closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Decode test Errorf argument order

2 participants